package com.jwell.panprovider.model

import com.jwell.driverapp.tools.BaseSubscriber
import com.jwell.panprovider.application.App
import com.jwell.panprovider.contract.TransportPlaneContract
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * Created by 76577 on 2018/4/21.
 * 运输计划
 */
class TransportPlaneModel : TransportPlaneContract.Model, BaseModel() {
    override fun getListData(request: RequestData, baseSubscriber: BaseSubscriber) {
        if (App.DEBUG) println("运输计划列表" + request.toString())
        getApiStore().appGetFuelPlanPage(request)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(baseSubscriber)
    }

    /**
     * fuelState (integer, optional): 供应状态 1、待供应 2、供应中 3、供应结束 4、全部 ,
    filter (string, optional): 关键词搜索 ,
    planCode (string, optional): 计划编码 ,
    planType (integer, optional): 计划类型 1、按合同号 2、按品名 = ['1', '2'],
    materialName (string, optional): 物质名称 ,
    forwardingUnit (string, optional): 发货单位 ,
    receivingUnit (string, optional): 收货单位 ,
    fuelStateDate (string, optional): 供应时间-开始 ,
    fuelEndDate (string, optional): 供应时间-结束 ,
    measurementMethod (integer, optional): 计量方式 1、先重后空 2、先空后重 3、标证出皮 4、只称重车 5、只称空车 = ['1', '2', '3', '4', '5'],
    supplierName (string, optional): 供应商 ,
    mtrlOrderNo (string, optional): 合同号 ,
    ids (Array[integer], optional): 购选导出的计划Ids ,
    sorting (string, optional): 排序字段 ,
    maxResultCount (integer, optional): 每页显示多少条数据 ,
    skipCount (integer, optional): 跨页数据 ,
    filterGroup (Jwell.Filter.FilterGroup, optional): 自动查询条件组
     */
    data class RequestData(var fuelState: Int? = null,
                           var maxResultCount: Int? = null,
                           var skipCount: Int? = null,
                           var fuelStateDate: String? = null,
                           var fuelEndDate: String? = null,
                           var filter: String? = null)
}